package com.hinnotek.amoeba.ui.activity.old

import android.os.Bundle
import android.view.*
import com.lee.common.base.BaseActivity
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.databinding.ActivityInvoiceAddBinding
import com.hinnotek.amoeba.utilities.ToastUtils
import com.hinnotek.amoeba.ext.initAdapter
import com.xuexiang.xui.utils.ResUtils
import com.xuexiang.xutil.common.StringUtils

class InvoiceAddActivity : BaseActivity<ActivityInvoiceAddBinding>() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setLeftVisible(true)
        setTitle("发票")

        setContentView(R.layout.activity_invoice_add)
    }

    override fun initVew() {
        bindingView.rbInvoiceTrue.setOnClickListener { v: View? ->
            val escInvoiceAmoebaS = bindingView.spinnerInvoiceAmoeba.editText.text.trim()
            if (StringUtils.isEmpty(escInvoiceAmoebaS)) {
                ToastUtils.show(mContext, "请选择阿米巴")
                return@setOnClickListener
            }
            val escInvoiceContractS = bindingView.spinnerInvoiceContract.editText.text.trim()
            if (StringUtils.isEmpty(escInvoiceContractS)) {
                ToastUtils.show(mContext, "请选择合同")
                return@setOnClickListener
            }
            val escInvoiceUnitS = bindingView.spinnerInvoiceUnit.editText.text.trim()
            if (StringUtils.isEmpty(escInvoiceUnitS)) {
                ToastUtils.show(mContext, "请选择签署单位")
                return@setOnClickListener
            }
        }
    }

    override fun setData() {
        bindingView.spinnerInvoiceAmoeba.initAdapter(ResUtils.getStringArray(R.array.sort_mode_entry))
        bindingView.spinnerInvoiceContract.initAdapter(ResUtils.getStringArray(R.array.sort_mode_entry))
        bindingView.spinnerInvoiceUnit.initAdapter(ResUtils.getStringArray(R.array.sort_mode_entry))
    }
}